import request from '@/utils/request'

// 课程列表
export function loadTemsCourseList(data) {
	return request({
		url: '/api/course/TemsCourse/getList',
		method: 'post',
		data
	})
}

// 课程列表-我的考试
export function myExamList(data) {
    return request({
        url: '/api/exam/TemsExam/myExamList',
        method: 'post',
		data
    })
}

// 专题列表
export function getScopeList(data) {
  return request({
    url: "/api/course/TemsSubject/getScopeList",
    method: "post",
    data: {
      sort: "desc",
      sidx: "",
      ...data,
    },
  });
}

export function getSubjectDetail(id) {
  return request({
    url: "/api/course/TemsSubject/detail/"+id,
  });
}

// 视频
export function getTemsCourseDetail(id){
  return request({
    url: "/api/course/TemsCourse/detail/"+id,
  });
}

// 开始答题
export function startExamTask(id) {
  return request({
    url: "/api/exam/TemsExam/startExam/"+id,
    method: "post",
    data:{
      courseId:''
    }
  });
}

// 提交答案
export function submitExamTask(id,data) {
  return request({
    url: "/api/exam/TemsExamTask/submit/"+id,
    method: "put",
    data:data
  });
}

// 查看解析
export function analysisExamTask(id) {
  return request({
    url: `/api/exam/TemsExamTask/${id}`,
    method: "get",
    params: {
		id
	}
  });
}

export function studySubject(id) {
  return request({
    url: "/api/course/TemsSubject/studySubject/"+id,
    method: "post",
  });
}

// 预览文件
export function PreviewFile(params) {
  return request({
    url: `/api/file/Uploader/Preview`,
    method: 'get',
	params: params
  })
}

/**
 * 课程学习
 */
export function TemsCourseStudy(chapterId, process) {
  return request({
    url: `/api/course/TemsCourse/study/${chapterId}`,
    method: "POST",
    data: { process: process || 0 },
  });
}
